 
 
const WIDTH = 1440 // refer to Bootstrap's responsive design

export default {
  watch: {
    $route(route) {
      if (this.device === 'mobile' && this.sidebar.opened) {
        store.dispatch('app/closeSideBar', { withoutAnimation: false })
      }
    }
  },
  beforeMount() {
    window.addEventListener('resize', this.$_resizeHandler)
  },
  beforeDestroy() {
    window.removeEventListener('resize', this.$_resizeHandler)
  },
  created() {
    this.setRem()
  },
  methods: {
    $_resizeHandler() {
      this.setRem()
    },
    setRem() {
      const scale = document.documentElement.clientWidth / WIDTH * 100;
      document.documentElement.style.fontSize = scale + 'px';
    }
  }
}
